export interface NetworkConfig {
    chainId: number;
    name: string;
    rpcUrl: string;
    symbol: string;
    explorer?: string;
}

export interface Method {
    name: string;
    inputs: {
        name: string;
        type: string;
    }[];
    outputs: {
        name: string;
        type: string;
    }[];
    stateMutability: 'pure' | 'view' | 'nonpayable' | 'payable';
    type: 'function' | 'constructor' | 'fallback';
}

export interface AppState {
    abi: string;
    methods: Method[];
    contractAddress: string;
    currentMethod?: Method;
    result?: any;
    error?: string;
    networks: NetworkConfig[];
    currentNetwork: NetworkConfig;
    customRpc: string;
}

export type AppAction =
    | { type: 'SET_ABI'; payload: string }
    | { type: 'SET_METHODS'; payload: Method[] }
    | { type: 'SET_CONTRACT_ADDRESS'; payload: string }
    | { type: 'SET_CURRENT_METHOD'; payload: Method }
    | { type: 'SET_RESULT'; payload: any }
    | { type: 'SET_ERROR'; payload: string }
    | { type: 'SET_NETWORK'; payload: NetworkConfig }
    | { type: 'SET_CUSTOM_RPC'; payload: string };